package com.key.util;

import java.io.FileInputStream;
import java.util.Properties;

public class PropertiesUtil {
	private Properties prop = null;// 属性集合对象
	private FileInputStream fis = null;

	/**
	 * 读取properties
	 * 
	 * @param file
	 * @return
	 * @throws Exception
	 */
	public Properties getProperties(String file) throws Exception {
		try {
			prop = new Properties();
			FileInputStream fis = new FileInputStream(file);// 属性文件输入流
			prop.load(fis);// 将属性文件流装载到Properties对象中
		} catch (Exception e) {
			throw e;
		}
		return prop;
	}

	/**
	 * 关闭读取文件流
	 * 
	 * @throws Exception
	 */
	public void close() throws Exception {
		try {
			if (fis != null) {
				fis.close();
			}
		} catch (Exception e) {
			throw e;
		}
	}
}
